package com.xintoucloud.pbs.dao.impl;

import java.io.Serializable;
import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.xintoucloud.pbs.dao.JoinMeetingInformationDao;
import com.xintoucloud.pbs.entity.JoinMeetingInformation;
@Repository@Transactional
public class JoinMeetingInformationDaoImpl implements JoinMeetingInformationDao{

	@Autowired
	private SessionFactory sessionFactory;
	@Override
	public Serializable save(JoinMeetingInformation jmi) {
		return sessionFactory.getCurrentSession().save(jmi);
	}

	@Override
	public void delete(Integer jmid) {
		sessionFactory.getCurrentSession().delete(jmid);
	}

	@Override
	@Transactional(readOnly=true)
	public JoinMeetingInformation getOne(Integer jmid) {
		return sessionFactory.getCurrentSession().get(JoinMeetingInformation.class, jmid);
	}

	@SuppressWarnings("unchecked")
	@Override
	@Transactional(readOnly=true)
	public List<JoinMeetingInformation> list(Integer bid) {
		return sessionFactory.getCurrentSession().createQuery("from JoinMeetingInformation where bid=?0")
				.setParameter(0, bid)
				.getResultList();
	}

}
